package autoproperties;

import controllers.Controller;
import annotation.PropertyAnnotation;
import annotation.PropertyAnnotation.ConfigName;

public class AutoProperties {

	private static final String TRUE = "true";

	private static AutoProperties AUTO_PROPERTIES;

	@PropertyAnnotation(getConfigName = ConfigName.garageProperty)
	private String garageProperty;

	@PropertyAnnotation(getConfigName = ConfigName.shiftProperty)
	private String shiftProperty;

	@PropertyAnnotation(getConfigName = ConfigName.deleteProperty)
	private String deleteProperty;

	private AutoProperties() {

		Controller.setPropertyByAnnotation(this);

	}

	public static AutoProperties getInstance() {
		if (AUTO_PROPERTIES == null) {
			AUTO_PROPERTIES = new AutoProperties();
		}
		return AUTO_PROPERTIES;
	}

	public boolean getGarageManager() {
		return garageProperty.equals(TRUE);
	}

	public boolean getPermissionShiftTimeOrder() {
		return shiftProperty.equals(TRUE);
	}

	public boolean getPermissionDeleteOrder() {
		return deleteProperty.equals(TRUE);
	}

}
